package com.jike.shop.cloud.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class Payment {

    public static final int STATE_INIT = 0; //订单生成

    public static final int STATE_SUCCESS = 2; // 支付成功

    public static final int STATE_ACTING = 1; //支付中

    public static final int STATE_REFUNDED = 5; //已退款

    public static final int STATE_CLOSED = 6; //超时关闭

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableLogic(value = "0", delval = "1")
    private Boolean deleted;

    /**
     * 支付渠道编号
     */
    private String channelCode;

    /**
     * 商户订单编号
     */
    private String orderNo;

    /**
     * 第三方支付渠道的流水号
     */
    private String transactionNo;

    /**
     * 订单总金额，精确到分
     */
    private Integer amount;

    /**
     * 支付状态:0: 支付订单生成, 1: 等待支付中, 2:支付成功, 3:支付失败, 4:已撤销, 5:已退款, 6:交易已关闭
     */
    private Integer status;

    /**
     * 第三方支付成功的时间
     */
    private LocalDateTime paymentTime;

    /**
     * 订单过期时间
     */
    private LocalDateTime expireTime;

    /**
     * 收到异步通知的时间
     */
    private LocalDateTime notifyTime;

    /**
     * 支付备注
     */
    private String remark;

    /**
     * 客户端ip
     */
    private String clientIp;
}
